home *** CD-ROM | disk | FTP | other *** search
- ///////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////
- // This example code is from the book:
- //
- // Object-Oriented Programming with C++ and OSF/Motif
- // by
- // Douglas Young
- // Prentice Hall, 1992
- // ISBN 0-13-630252-1
- //
- // Copyright 1991 by Prentice Hall
- // All Rights Reserved
- //
- // Permission to use, copy, modify, and distribute this software for
- // any purpose except publication and without fee is hereby granted, provided
- // that the above copyright notice appear in all copies of the software.
- ///////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////
-
-
- //////////////////////////////////////////////////
- // Timer.h: Provide clock for the stopwatch
- ///////////////////////////////////////////////////
- #ifndef TIMER_H
- #define TIMER_H
- #include <Xm/Xm.h>
-
- class Face; // Timer objects send messages a Face object
-
- class Timer {
-
- private:
-
- // Static member function used for TimeOut callback
-
- static void tickCallback ( XtPointer, XtIntervalId* );
-
- void tick(); // Called every _interval milliseconds
-
- Face *_face; // The Face object updated with each tick
- int _counter; // Current number of ticks
- int _interval; // Time in milliseconds between updates
- XtIntervalId _id; // Identifier of current TimeOut
- XtAppContext _app; // Required by Xt functions
-
- public:
-
- Timer ( XtAppContext, Face *, int );
-
- void start(); // Resets, and starts the clock ticking
- void stop(); // Stops the clock
- float elapsedTime(); // Returns time since timer started
- };
- #endif
-